﻿@using zichan.Entity
@using zichan.Common;
@model IPagedList<AsssetLog>
@{
    ViewBag.Title = "资产管理日志";
}

@section Pagetitle{
    @AdminCommon.PageTitle("资产管理日志", "")
}
<style>
    #pagebar li {
        display: inline-block;
    }
</style>
<div class="portlet">
    <div class="portlet-title">
        <div class="caption ">
            <i class="fa fa-table"></i>资产管理日志
        </div>
    </div>
    <div class="portlet-body">
        <div class="table-container">
            <div class="dataTables_wrapper dataTables_extended_wrapper no-footer">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="table-group-actions pull-left">
                            @using (Html.BeginForm("index", "AssetLog", FormMethod.Get, new { @class = "form-inline" }))
                            {<input type="hidden" name="pageSize" value="@ViewBag.pageSize" />
                                <div class="form-group">
                                    <input type="text" placeholder="请输入资产编号" name="code" value="@ViewBag.code" class="form-control input-small input-sm" />
                                </div>
                                <div class="form-group">
                                    <input type="text" placeholder="请输入资产名称" name="name" value="@ViewBag.name" class="form-control input-small input-sm" />
                                </div>
                                <div class="form-group">
                                    <input type="text" placeholder="请输入职员" name="staff" value="@ViewBag.staff" class="form-control input-small input-sm" />
                                </div>
                                <div class="form-group">
                                    <input type="text" placeholder="请输入操作关键字" name="keyWord" value="@ViewBag.keyWord" class="form-control input-small input-sm" />
                                </div>
                                <div class="form-group">
                                    <div class="input-group">
                                        <input type="text" placeholder="时间" name="sdt" id="sdt" value="@ViewBag.sdt" class="form-control input-small input-sm dateSdt" />
                                        <span class="input-group-addon dateSdt">
                                            <i class="fa fa-calendar bigger-110 "></i>
                                        </span>
                                    </div>
                                    至
                                    <div class="input-group">
                                        <input type="text" placeholder="时间" name="edt" id="edt" value="@ViewBag.edt" class="form-control input-small input-sm dateEdt" />
                                        <span class="input-group-addon dateEdt">
                                            <i class="fa fa-calendar bigger-110"></i>
                                        </span>
                                    </div>
                                </div>
                                <button class="btn btn-sm yellow table-group-action-submit"><i class="fa fa-check"></i> 搜索</button>
                            }
                        </div>
                    </div>
                </div>
                <div class="table-scrollable">
                    <table class="table  table-hover">
                        <thead>
                            <tr class="heading">
                                <th> 时间 </th>
                                <th>资产名称</th>
                                <th>资产编号</th>
                                <th>职员</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (AsssetLog r in Model)
                            {
                                <tr>
                                    <td>@r.Time</td>
                                    <td>@r.AssetName</td>
                                    <td>@r.Code</td>
                                    <td>@r.StaffName</td>
                                    <td>
                                        @r.Operation
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-sm-12 dataTables_paginate">
                        <div class="pull-right">
                            <ul id="pagebar" style="display:inline-block;margin-right:10px;color:#3175AF;">
                                <li>
                                    每页<select name="pageSize" id="pageSize" class="select2" style="width:50px;font-size:18px;">
                                        <option value="@ViewBag.pageSize">@ViewBag.pageSize</option>
                                        @foreach (var s in ViewBag.pageSizes)
                                        {
                                            <option value="@s.Value">@s.Text</option>
                                        }
                                    </select>个
                                </li>
                                <li>第@(Model.PageNumber)/共@(Model.PageCount)页</li>
                                @using (Html.BeginForm("index", "AssetLog", FormMethod.Get, new { @style = "display: inline-block;" }))
                                {
                                    <li style="display:none;">
                                        <input type="hidden" name="pageSize" value="@ViewBag.pageSize" />
                                        <input type="hidden" name="name" value="@ViewBag.name" />
                                        <input type="hidden" name="code" value="@ViewBag.code" />
                                        <input type="hidden" name="staff" value="@ViewBag.staff" />
                                        <input type="hidden" name="keyWord" value="@ViewBag.keyWord" />
                                        <input type="hidden" name="sdt" value="@ViewBag.sdt" />
                                        <input type="hidden" name="edt" value="@ViewBag.edt" />
                                        @Html.TextBox("pageCount", Model.PageCount)
                                    </li>
                                            <li>跳转至<input name="selectedPage" style="width:40px;font-size:18px;" value="@ViewBag.selectedPage" />页</li>
                                            <li><button type="submit">GO</button></li>}
                            </ul>
@if (Model.PageCount > 1)
{
                            <ul id="pagebar" class="pagination" style="margin:0px;float:right;">
                                <li><a href="@Url.Action("Index", "AssetLog", new { code = ViewBag.code, name = ViewBag.name, staff = ViewBag.staff, keyWord = ViewBag.keyWord, sdt = ViewBag.sdt, edt = ViewBag.edt,pageSize = ViewBag.pageSize, page = 1 })">首页</a></li>
                                <li>@Html.ActionLink("上一页", "Index", "AssetLog", new { code = ViewBag.code, name = ViewBag.name, staff = ViewBag.staff, keyWord = ViewBag.keyWord, sdt = ViewBag.sdt, edt = ViewBag.edt, pageSize = ViewBag.pageSize, page = Model.PageNumber - 1 }, null)</li>
                                <li>@Html.ActionLink("下一页", "Index", "AssetLog", new { code = ViewBag.code, name = ViewBag.name, staff = ViewBag.staff, keyWord = ViewBag.keyWord, sdt = ViewBag.sdt, edt = ViewBag.edt, pageSize = ViewBag.pageSize, page = (Model.PageNumber + 1 < Model.PageCount ? Model.PageNumber + 1 : Model.PageCount) }, null)</li>
                                <li>@Html.ActionLink("末页", "Index", "AssetLog", new { code = ViewBag.code, name = ViewBag.name, staff = ViewBag.staff, keyWord = ViewBag.keyWord, sdt = ViewBag.sdt, edt = ViewBag.edt, pageSize = ViewBag.pageSize, page = Model.PageCount }, null)</li>
                            </ul>}
                        </div>

                    </div>
                </div>



            </div>

        </div>
    </div>
</div>
@section footer{
    <script src="/assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var formatDateTime = function (date) {
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            var d = date.getDate();
            return y + '/' + m + '/' + d;
        };
        $('.dateSdt').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 0,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            minView: 'month',　　　　//日期时间选择器所能够提供的最精确的时间选择视图。
            format: 'yyyy/m/d'
        }).on('changeDate', function (ev) {
            $("#sdt").val(formatDateTime(new Date(ev.date.valueOf() - 28800000)));
        });
        $('.dateEdt').datetimepicker({
            //language: 'zh-CN',
            weekStart: 1,
            todayBtn: 0,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            minView: 'month',　　　　//日期时间选择器所能够提供的最精确的时间选择视图。
            format: 'yyyy/m/d'
        }).on('changeDate', function (ev) {
            $("#edt").val(formatDateTime(new Date(ev.date.valueOf() - 28800000)));
        });
        $(function () {
            $('#pageSize').on("change", function () {
                var name = $("input[name='name']").val();
                var staff = $("input[name='staff']").val();
                var keyWord = $("input[name='keyWord']").val();
                var code = $("input[name='code']").val();
                var sdt = $("input[name='sdt']").val();
                var edt = $("input[name='edt']").val();
                var size = $(this).val();
                location.href = "/AssetLog/Index?code=" + code + "&name=" + name + "&staff=" + staff + "&keyWord=" + keyWord + "&sdt=" + sdt + "&edt=" + edt + "&pageSize=" + size;
            });
        });
    </script>
}